#pragma once

#include "spellcheck.h"
#include "trie.h"
#include <memory>

namespace NSpellCheck {

class PerWordSpellChecker: public ISpellChecker {
public:
    PerWordSpellChecker(Trie<int>* unigrams);
    virtual ~PerWordSpellChecker();
    virtual void process(const Phrase& phrase, std::vector<Variation>* suggestions) const;
private:
    double languageModel(const Phrase& phrase) const;
    void findWordVariations(const std::string& word, std::vector<Variation>* variations) const;
private:
    std::auto_ptr<Trie<int> > unigrams;
};

}
